#ifndef SCHEDULE_H
#define SCHEDULE_H

#include <QDialog>
#include <QTcpSocket>
#include "mytablelist.h"
#include "pack.h"

namespace Ui {
class schedule;
}

class schedule : public QDialog {
    Q_OBJECT

public:
    explicit schedule(QWidget *parent = nullptr);
    ~schedule();

    void setSocket(QTcpSocket* socket);
    void handleScheduleResponse(const Pack& pack);

private slots:
    void on_pushButton_save_clicked();
    void on_pushButton_update_clicked();
    void on_pushButton_find_clicked();
    void on_pushButton_del_clicked();
    void on_pushButton_show_clicked();
    void loadDataAfterSocketReady(); // 新增：socket就绪后加载数据
    void onCurrentRowChanged(const QModelIndex &current, const QModelIndex &previous);

private:
    Ui::schedule *ui;
    myTablelist *model;
    QTcpSocket *tcpSocket;
    int currentRow = -1;
};

#endif // SCHEDULE_H
